﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="AquariumList.aspx.vb" Inherits="FishTank.AquariumList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="alternate" type="application/rss+xml" href="/Pages/AquariumRSS.aspx" title="RSS feed" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="rss">
        <a href="/Pages/AquariumRSS.aspx"><asp:Image ID="rssImg" runat="server" ImageUrl="~/Images/rss.png" /></a>
    </div>

    <h1>Member Aquariums</h1>
       
    <div class="search">
        Search by 
        <asp:DropDownList ID="SearchType" runat="server">
            <asp:ListItem Value="Title">Title</asp:ListItem>
            <asp:ListItem Value="MemberFullName">Member</asp:ListItem>
            <asp:ListItem Value="AquariumType">Type</asp:ListItem>
            <asp:ListItem Value="Product">Product</asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="SearchBox" runat="server" AutoPostBack="True"></asp:TextBox>
        <asp:Button ID="SearchButton" runat="server" Text="Go" />
        <asp:Button ID="ResetButton" runat="server" Text="Reset" />
    </div>

    <p>
    <asp:GridView ID="ListGrid" runat="server"
        AutoGenerateColumns="False" AllowSorting="True" Width="100%"
        CssClass="gridView">

        <AlternatingRowStyle CssClass="gridAltRowView" />

        <EmptyDataTemplate>
        <p>Your search did not match any aquariums.</p>
        </EmptyDataTemplate>
        
        <Columns>
            <asp:TemplateField HeaderText="Photo">
                <ItemTemplate>  
                    <a href="/Pages/AquariumDetail.aspx?ID=<%# Eval("ID") %>">
                        <asp:Image ID="AquariumImage" runat="server"
                                   ImageUrl='<%# getPhotoPath(Eval("ImagePath")) %>' AlternateText="<%# Bind('ImageTitle') %>"/>
                    </a>
                </ItemTemplate>
                <ItemStyle Width="128" Height="64" />
            </asp:TemplateField>
            <asp:HyperLinkField DataNavigateUrlFields="ID" 
                DataNavigateUrlFormatString="/Pages/AquariumDetail.aspx?ID={0}" DataTextField="Title" 
                HeaderText="Title" SortExpression="Title" />
            <asp:HyperLinkField DataNavigateUrlFields="MemberUserName" 
                DataNavigateUrlFormatString="/Pages/MemberDetail.aspx?UserName={0}" DataTextField="MemberFullName" 
                HeaderText="Member" SortExpression="MemberFullName" />
            <asp:BoundField DataField="CreatedDateTime" HeaderText="Created Date" 
                dataformatstring="{0:MMMM d, yyyy}"
                SortExpression="CreatedDateTime" >
            <ItemStyle Width="64px" />
            </asp:BoundField>
            <asp:BoundField DataField="TotalComments" HeaderText="Comments" SortExpression="TotalComments"/>
            <asp:BoundField DataField="AquariumType" HeaderText="Type" SortExpression="AquariumType"/>
            <asp:BoundField DataField="Volume" HeaderText="Volume (liters)" 
                SortExpression="Volume" >
            <ItemStyle Width="64px" />
            </asp:BoundField>
            <asp:BoundField DataField="Temperature" HeaderText="Temperature (°C)" 
                SortExpression="Temperature" >
            <ItemStyle Width="64px" />
            </asp:BoundField>
            <asp:HyperLinkField DataNavigateUrlFields="ProductURL" 
                DataNavigateUrlFormatString="{0}" DataTextField="Product" 
                HeaderText="Manufacturer" SortExpression="Product" Target="_blank" />
        </Columns>
    </asp:GridView>
</p>
<p>
    <asp:HyperLink ID="AddItemLink" runat="server"
        NavigateUrl="~/Pages/AquariumDetail.aspx?Action=Add">Add your aquarium</asp:HyperLink>
</p> 
</asp:Content>
